#pragma once

#include <iostream>
#include <functional>
#include <string>
#include <vector>   

class TaskList
{
public:
    static void PrintLog()
    {
        std::cout << "这是一个打印日志任务..." << std::endl;
    }
    static void OperMysql()
    {
        std::cout << "这是一个数据库语句任务..." << std::endl;
    }
    static void CheckNet()
    {
        std::cout << "这是一个检查网路情况任务..." << std::endl;
    }
};

class Task
{
private:
    using func_t = std::function<void()>;
public:
    Task() = default;
    ~Task() = default;

    void loadTask()
    {
        m_taskList.push_back(TaskList::PrintLog);
        m_taskList.push_back(TaskList::OperMysql);
        m_taskList.push_back(TaskList::CheckNet);
    }

    void runTask()
    {
        for (auto &task : m_taskList)
        {
            task();
        }
    }

private:
    std::vector<func_t> m_taskList;
};